"""MxOnline URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url,include
from rest_framework_jwt.views import obtain_jwt_token
import xadmin
from .settings import MEDIA_ROOT
from django.views.static import serve
from rest_framework.routers import DefaultRouter
from course.views import BannerViewSet,CourseViewSet,HotSearchsViewset
from users.views import SmsCodeViewSet,RegisterViewset,MessageCountViewSet,MessageViewSet
from operation.views import StudentsGradeViewSet,CourseCommentsViewSet,ExamListViewSet
from rest_framework.documentation import include_docs_urls
from operation.views import UserScoreViewSet,SignViewSet,UserAnswerLogViewSet
from course.views import VideoViewSet
from users.views import MyTimeTableViewSet,MyScoreViewSet,WechatLoginView
from blog.views import BlogViewSet,CommentViewSet,CollectViewSet
from blog.views import MyArticleViewSet
from django.contrib import admin

router = DefaultRouter()
router.register(r"comment",CourseCommentsViewSet,base_name="comment")
router.register(r"banners",BannerViewSet,base_name="banners")
router.register(r"hotsearch",HotSearchsViewset,base_name="hotsearch")
router.register(r"course",CourseViewSet,base_name="course")
router.register(r"code",SmsCodeViewSet,base_name="code")
router.register(r"user",RegisterViewset,base_name="user")
router.register(r"myclass",StudentsGradeViewSet,base_name="myclass")
router.register(r"video",VideoViewSet,base_name="video")
router.register(r"cmsg",MessageCountViewSet,base_name="cmsg")
router.register(r"messages",MessageViewSet,base_name="messages")
router.register(r"mytable",MyTimeTableViewSet,base_name="mytable")
router.register(r"myexam",ExamListViewSet,base_name="myexam")
router.register(r"myscore",MyScoreViewSet,base_name="myscore")
router.register(r"userscore",UserScoreViewSet,base_name="userscore")
router.register(r"signs",SignViewSet,base_name="signs")
router.register(r"blog",BlogViewSet,base_name="blog")
router.register(r"myblog",MyArticleViewSet,base_name="myblog"),
router.register(r"discuss",CommentViewSet,base_name="discuss")
router.register(r"collect",CollectViewSet,base_name="collect")
router.register(r"answerlog",UserAnswerLogViewSet,base_name="answerlog")


urlpatterns = [
    url(r'^api/v1/', include(router.urls)),
    url(r"docs",include_docs_urls(title="金狗教育")),
    url(r'^api-auth/', include('rest_framework.urls')),
    url(r'^admin/', xadmin.site.urls),
    url(r'^xadmin/', admin.site.urls),
    url(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}),
    url(r'^api/v1/login/$', obtain_jwt_token),
    url(r'^teacher/',include("teacheradmin.urls",namespace="teacher")),
    url(r'^notifications/', include('notifications.urls')),
    url(r"^api/v1/wechat",WechatLoginView.as_view())
]